import { mapGetters } from 'vuex';

export default {
  computed: {
    ...mapGetters(['pageOptions']),
  },
  data() {
    return {
      tableData: [], // 表格数据
      pageVO: {
        total: 0,
        pageSize: 10,
        pageNum: 1,
      },
    };
  },
  methods: {
    /**
     * 分页大小改变
     *
     * @param {*} size
     */
    handleSizeChange(size) {
      this.pageVO.pageNum = 1;
      this.pageVO.pageSize = size;
      this.getTableData();
    },
    /**
     * 页码改变
     *
     * @param {*} num
     */
    handleCurrentChange(num) {
      this.pageVO.pageNum = num;
      this.getTableData();
    },
    /**
     * 编辑弹框事件
     *
     * @param {*} dialogRef 弹框实例
     * @param {*} row 当前编辑行,新增为空
     * @param {*} operationType Add(新增) Edit(编辑)
     */
    openDialogHandle(operationType = 'Add', row = null) {
      this.$refs.dialogRef?.openHandle(operationType, row);
    },
  },
};
